package com.xbk.seckill.common.model.message;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 错误消息，扣减库存失败，由商品微服务发送给订单微服务
 *
 * @author xiexu
 * @date 2025/2/26 08:47
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class ErrorMessage extends TopicMessage {

    /**
     * 全局事务编号
     */
    private Long txNo;

    /**
     * 商品id
     */
    private Long goodsId;

    /**
     * 购买数量
     */
    private Integer quantity;

    /**
     * 下单的类型
     */
    private String placeOrderType;

    /**
     * 是否扣减了缓存库存
     */
    private Boolean exception;

    /**
     * 库存分桶编号
     */
    private Integer bucketSerialNo;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 订单任务id
     */
    private String orderTaskId;

    public ErrorMessage(String destination,
                        Long txNo,
                        Long goodsId,
                        Integer quantity,
                        String placeOrderType,
                        Boolean exception,
                        Integer bucketSerialNo,
                        Long userId,
                        String orderTaskId) {
        super(destination);
        this.txNo = txNo;
        this.goodsId = goodsId;
        this.quantity = quantity;
        this.placeOrderType = placeOrderType;
        this.exception = exception;
        this.bucketSerialNo = bucketSerialNo;
        this.userId = userId;
        this.orderTaskId = orderTaskId;
    }

}
